#!/bin/bash

shopt -s nullglob


function show_it
{
    the_user=$1
    for f in /usr/mitra-dev/src/*/${the_user}-*
    do
        if [ -d ${f#${the_user}-} ]
        then
            module=$(echo ${f} | cut -f5 -d/)
            version=$(echo ${f} | cut -f6 -d/)
            echo ${module} ${version}
        fi
    done

    for f in /usr/oem-dev/*/*/${the_user}-*
    do
        if [ -d ${f#${the_user}-} ]
        then
            oem=$(echo ${f} | cut -f4 -d/)
            module=$(echo ${f} | cut -f5 -d/)
            version=$(echo ${f} | cut -f6 -d/)
            echo ${oem}-${module} ${version}
        fi
    done
}

if [ $# -gt 0 ]
then
    while [ $# -gt 0 ]
    do
        show_it $1
        shift
    done
else
    show_it ${USER}
fi


